/*
 * Copyright (C) 2025 ScreamingSandals
 *
 * This file is part of Screaming BedWars.
 *
 * Screaming BedWars is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Screaming BedWars is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with Screaming BedWars. If not, see <https://www.gnu.org/licenses/>.
 */

package org.screamingsandals.bedwars.config.migrate;

import java.io.File;
import java.util.concurrent.CompletableFuture;

public interface FileMigrator {
    void migrate(File file) throws Exception;

    default CompletableFuture<Void> migrateAsynchronously(File file) {
        return CompletableFuture.runAsync(() -> {
            try {
                migrate(file);
            } catch (Exception e) {
                throw new RuntimeException("Could not migrate file!", e);
            }
        });
    }
}
